﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace com.qbengo.utility.nodepicker
{
    public partial class AddEvent : Form
    {
        private string eventName;
        public event EventHandler accept;
        public AddEvent()
        {
            InitializeComponent();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.eventNameTextBox.Text = "";
        }

        private void addButton_Click(object sender, EventArgs e)
        {
            eventName = eventNameTextBox.Text;
            if (eventName == "")
            {
                MessageBox.Show("Name can't be blank!");
                return;
            }
            if (accept != null)
            {
                accept(this, EventArgs.Empty); //当窗体触发事件，传递自身引用
                this.Close();
            }  
        }

        public string EventName
        {
            get
            {
                return eventName;
            }
        }
    }
}
